<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>用户注册</title>
    <link rel="stylesheet" type="text/css" href="./css/login.css">
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.0/jquery.js"></script>
    <script type="text/javascript">
        // 验证输入不为空的脚本代码
        //获取数据传到后台，再接收返回值 插入数据库转到login
        const REGITSER="http://localhost:8080/mi/register";
        $(function () {
            $("#sub").click(function () {
                let name = $("#username").val();
                let password = $("#password").val();
                let phone= $("#phone").val();

                $.post(REGITSER, { name:name,
                    password:password,
                    phone:phone},function () {
                            alert("注册成功");
                            location.href="login.html";
                })

            })

        })
    </script>
</head>
<body>
<form >
    <div class="regist">
        <div class="regist_center">
            <div class="regist_top">
                <div class="left fl">会员注册</div>
                <div class="right fr"><a href="./index.html" target="_self">小米商城</a></div>
                <div class="clear"></div>
                <div class="xian center"></div>
            </div>
            <div class="regist_main center">
                <div class="username">用&nbsp;&nbsp;户&nbsp;&nbsp;名:&nbsp;&nbsp;<input class="shurukuang" type="text" id="username" name="username" placeholder="请输入你的用户名"/><span>请不要输入汉字</span></div>
                <div class="username">密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码:&nbsp;&nbsp;<input class="shurukuang" type="password" id="password" name="password" placeholder="请输入你的密码"/><span>请输入6位以上字符</span></div>

                <div class="username">确认密码:&nbsp;&nbsp;<input class="shurukuang" type="password" id="repassword" name="repassword" placeholder="请确认你的密码"/><span>两次密码要输入一致哦</span></div>
                <div class="username">手&nbsp;&nbsp;机&nbsp;&nbsp;号:&nbsp;&nbsp;<input class="shurukuang" type="text" id="phone" name="tel" placeholder="请填写正确的手机号"/><span>填写下手机号吧，方便我们联系您！</span></div>

            </div>
            <div class="regist_submit">
                <input class="submit" type="button" name="submit" id="sub"   value="立即注册" >
            </div>

        </div>
    </div>
</form>
</body>
</html>